﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using MinhTam.DataAccess.Web;


public partial class khachsan : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            loadkhachsan();

        }
    }
    public void loadkhachsan()
    {
        try
        {
            string sql = @"SELECT tt.*
            FROM TINH_THANH tt
            WHERE EXISTS(SELECT TOP 1 ks.KHACH_SAN_ID FROM KHACH_SAN ks WHERE ks.TINH_THANH=tt.TINH_THANH_ID) order by isnull(sap_xep,9999)";
            DataTable dt = SQLConnectWeb.GetTable(sql);
            listTP.DataSource = dt;
            listTP.DataBind();
            
        }
        catch
        {
        }
    }


    protected void listTP_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        DataRowView r = e.Item.DataItem as DataRowView;

        String sql = @"select * from khach_san where tinh_thanh = " + r["tinh_thanh_id"]+" order by ten_khach_san";
        DataTable table = SQLConnectWeb.GetData(sql);
        Repeater rp = (Repeater)e.Item.FindControl("listKS");
        rp.DataSource = table;
        rp.DataBind();

    }
}